package com.koron.ticket.work.workinfo.service;

import com.koron.ticket.work.workinfo.bean.WorkInfo;
import com.koron.ticket.work.workinfo.bean.WorkInfoQuery;
import com.koron.ticket.work.workinfo.mapper.WorkInfoMapper;
import org.koron.ebs.mybatis.SessionFactory;
import org.springframework.stereotype.Service;

@Service
public class WorkInfoService {
    public void insert(SessionFactory factory, WorkInfo workInfo) {
        WorkInfoMapper workInfoMapper = factory.getMapper(WorkInfoMapper.class);
        workInfoMapper.insert(workInfo);
    }

    public void update(SessionFactory factory, WorkInfo workInfo) {
        WorkInfoMapper workInfoMapper = factory.getMapper(WorkInfoMapper.class);
        workInfoMapper.update(workInfo);
        return;
    }

    public WorkInfo getSingle(SessionFactory factory, WorkInfoQuery workInfoQuery) {
        WorkInfoMapper workInfoMapper = factory.getMapper(WorkInfoMapper.class);
        WorkInfo workInfo = workInfoMapper.getSingle(workInfoQuery);
        return workInfo;
    }

    public void deleteByWorkTicketId(SessionFactory factory, String workTicketId) {
        WorkInfoMapper workInfoMapper = factory.getMapper(WorkInfoMapper.class);
        workInfoMapper.deleteByWorkTicketId(workTicketId);
    }
}
